<?php
class Megadrupal_Slider_Block_Adminhtml_Slider_Edit_Tab_Slide extends Mage_Adminhtml_Block_Widget_Form
{
    public function __construct() {
        parent::__construct();
        
        $this->setTemplate('slider/edit.phtml');
        $this->setId("megadrupal_gallery_content");
        $this->setHtmlId("megadrupal_gallery_content");
    }
    
    /**
     * Load Wysiwyg on demand and Prepare layout
     */
    protected function _prepareLayout()
    {
        parent::_prepareLayout();
        $this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
    }
    
    protected function _prepareForm()
    {

        $form = new Varien_Data_Form();
        $this->setForm($form);        
        if (Mage::getSingleton("adminhtml/session")->getSliderData())
        {
            $form->setValues(Mage::getSingleton("adminhtml/session")->getSliderData());
            Mage::getSingleton("adminhtml/session")->setSliderData(null);
        } 
        elseif(Mage::registry("slider_data")) {
            $form->setValues(Mage::registry("slider_data")->getData());
        }



        return parent::_prepareForm();
    }
}
